package com.cjm.one.goods.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.dto.GoodsInfoDto;
import com.cjm.one.model.goods.entity.*;
import com.cjm.one.model.goods.vo.GoodsInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = ServerConstants.SERVER_ONE_GOODS)
public interface GoodsInfoClient {
    @GetMapping("/admin/goods/info/list")
    Result<Page<GoodsInfo>> pageList(@RequestParam(name = "current") Long current,
                                            @RequestParam(name = "size") Long size,
                                            @RequestParam(name = "name",required = false) String name,
                                            @RequestParam(name = "categoryId", required = false) Long categoryId);
    @GetMapping("/admin/goods/info/list/batch/{ids}")
    @Operation(summary = "批量查询")
    Result<List<GoodsInfo>> listBatch(@PathVariable(name = "ids") Long[] ids);
    @PostMapping("/admin/goods/info")
    @Operation(summary = "新增")
    Result<Boolean> save(@RequestBody GoodsInfoDto goodsInfoDto);

    @DeleteMapping("/admin/goods/info/{id}")
    @Operation(summary = "根据id删除")
    Result<Boolean> remove(@PathVariable("id") Long id);

    @PutMapping("/admin/goods/info")
    @Operation(summary = "修改")
    Result<Boolean> update(@RequestBody GoodsInfoDto goodsInfoDto);

    @GetMapping("/admin/goods/info/{id}")
    @Operation(summary = "根据id查询")
    Result<GoodsInfoVo> getById(@PathVariable("id") Long id);

    @GetMapping("/app/goods/info")
    @Operation(summary = "获取商品详情")
    Result<GoodsInfoVo> getByIdInfo(@RequestParam("id") Long id);



}
